package schoolWork.work02;

public class CashRegisterDemo {
    public static void main(String[] args) {
        CashRegister register = new CashRegister();
        double change;
        //第一个购买处理
        register.recordPurchase(30);
        register.recordPurchase(15.5);
        register.receivePayment(50);
        register.printReceipt();
        change = register.giveChange();
        System.out.println("Change:"+String.format("%.2f",change));
        //第二个购买处理
        register.recordPurchase(60);
        register.recordPurchase(28);
        register.recordPurchase(2.2);
        register.receivePayment(100);
        register.printReceipt();
        change = register.giveChange();
        System.out.println("Change:"+String.format("%.2f",change));

        //第二天
        CashRegister.reset();
    }
}
